using UnityEngine;
using UnityEngine.UI;

public class LogTool : MonoBehaviour
{
    //// <summary>
    /// 日志输入框
    /// </summary>
    private static InputField Log;

    void Start()
    {
        Log = transform.Find("Viewport/Content/Log").GetComponent<InputField>();
    }

    /// <summary>
    /// 输出日志
    /// </summary>
    /// <param name="info"></param>
    public static void WriteLog(string info)
    {
        if(Log.text.Length > 10000)Log.text = "";
        Log.text += string.Format("<color=green>{0}</color>\n", info);
    }
    /// <summary>
    /// 输出报错日志
    /// </summary>
    /// <param name="info"></param>
    public static void WriteError(string info)
    {
        if(Log.text.Length > 10000)Log.text = "";
        Log.text += string.Format("<color=red>错误：{0}</color>\n", info);
    }
}
